package com.example.basic.config;

/**
 * ClassName: RequestHolder
 * Description:
 * date: 2021/12/14 13:57
 * author zesion lee
 */
public class RequestHolder {
    private final static ThreadLocal<Integer> UserIdHolder = new ThreadLocal<>();

    public static void addUserId(Integer userId) {
        UserIdHolder.set(userId);
    }

    public static Integer getUserId() {
        return UserIdHolder.get();
    }

    public static void removeUserId() {
        UserIdHolder.remove();
    }
}
